package model;

/**
 * <p>
 * Title: Road</p>
 * <p>
 * Description: CS 343 Project. Stores the data model for the road
 * properties.</p>
 *
 * @date 11/18/2013
 *
 * @author Dylan Ahmann
 * @author Gregg Roemhildt - Class Programming and Javadocs
 * @author Sam Brockmann - Javadocs
 * @author Emily Hancock
 * @author Shirin Asadi
 *
 */
public class Road extends DrawableEdge {

    private double speedLimit;
    private double distance;

    /**
     * default constructor <br />
     * Initializes a and b, which are the "To" and "From" values.
     *
     * @param a First Vertex
     * @param b Second Vertex
     *
     */
    public Road(Vertex<double[]> a, Vertex<double[]> b) {
        super(a, b);
    }

    /**
     * alternate constructor
     *
     * @param a First Vertex
     * @param b Second Vertex
     * @param s speed limit
     *
     * Initializes a and b, which are the "To" and "From" values. Next,
     * calculates a weight based on the speed limit and distance and then sends
     * it to super().
     */
    public Road(Vertex<double[]> a, Vertex<double[]> b, double s) {
        super(a, b);
        speedLimit = s;
        distance = super.calcDistance(a.getPointData(), b.getPointData());
        super.setWeight(distance / s);
    }

    /**
     * getSpeedLimit - a getter for this Road's speed limit
     *
     * @return speedLimit
     */
    public double getSpeedLimit() {
        return speedLimit;
    }

    /**
     * getDistance - a getter for this Road's distance
     *
     * @return distance
     */
    public double getDistance() {
        return distance;
    }
}
